package edu.ccut.saturn.workflow.finishTaskModule.code;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.workflow.common.Constants;
import edu.ccut.saturn.workflow.model.ActivityInfo;
import edu.ccut.saturn.workflow.model.WorkFlowInfo;

public class IsMultiWorkitem extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		WorkFlowInfo workFlowInfo  =(WorkFlowInfo)parameterContext.getParameterValue(0);
		String activity_define_id = (String)parameterContext.getParameterValue(1);
		Boolean isMultiWorkitem = false;
		// 获得当前工作项对应活动的定义信息
		ActivityInfo activity = workFlowInfo.getActivityInfoById(activity_define_id);
		if (activity.getIsMulWorkItems().equals(
				Constants.ACTIVITY_ISMULWORKITEMS)) {//非多工作项
			isMultiWorkitem = false;
		}else{//多工作项
			isMultiWorkitem = true;
		}
		parameterContext.setParameter(2, isMultiWorkitem);
	}
}